<template>
	<view class="uni-container">
			<cu-custom bgColor="bg-gradual-blue" :isBack="true">
				<block slot="backText">返回</block>
				<block slot="content">退房申请</block>
			</cu-custom>
		<view class="scorll-style">
			<button size="default" type="primary"
			  style="width: 90%; margin: 10px 5%;"
			  @click="withDrawRoom()">申请退房</button>
		</view>
	</view>
</template>

<script>
	
	export default {
		name: 'withdrawroom',
		data() {
			return {
				
			}
		},
		mounted() {
			
		},
		methods: {
			withDrawRoom(){
				let http = this.$http;
				uni.showModal({
					title: '警告',
					content: '您确定要退房吗？',
					success: function (res) {
						if (res.confirm) {
							http.post('/sys/user/withdraw').then(res => {
								res = res.data;
								if(!res.success){
									uni.showToast({
										title: '退房失败',
										icon: 'error',
										duration: 2000
									});
								}
								else{
									uni.showToast({
										title: '退房成功',
										icon: 'success',
										duration: 2000
									});
								}
							})
						} else if (res.cancel) {
							//console.log('用户点击取消');
						}
					}
				});
				
			},
		},
	}
</script>

<style lang="scss">
</style>
